package common

import (
	"gopkg.in/yaml.v2"
	"io/ioutil"
)

var Conf *Config

func InitConfig(filename string) {
	yamlFile, err := ioutil.ReadFile(filename)

	if err != nil {
		return
	}

	Conf = &Config{}
	//yaml文件中的值赋给config  默认变量全小写为key
	err = yaml.Unmarshal(yamlFile, Conf)
}

type Config struct {
	MysqlUrl string `yaml:"MySqlUrl"` // 数据库连接地址
}
